/**
 * Project Name:JavaBaseReview
 * Package Name:com.xuwei.base.tree
 * author:David
 * Date:2016年5月12日上午10:34:05
 * Copyright (c) 2016, xw123box@126.com All Rights Reserved.
 *
 */
package com.xuwei.base.tree;

import com.xuwei.base.link.Iterator;
import com.xuwei.base.link.Node;

/**
 * @author David
 * @since 2016年5月12日 上午10:34:05
 * @version 
 * @since JDK 1.6
 */
public class BinaryTreeTest {

	public static void main(String[] args) {
		BinaryTreeLinked binTreeLink = new BinaryTreeLinked();
		binTreeLink.setRoot(new BinTreeNode());
		binTreeLink.getRoot().setData("aa");
		
		BinTreeNode lnode2 =  new BinTreeNode();
		lnode2.setData("bb");
		binTreeLink.getRoot().setLChild(lnode2);
		
		BinTreeNode rnode3 =  new BinTreeNode();
		rnode3.setData("33");
		binTreeLink.getRoot().setRChild(rnode3);
		
		BinTreeNode rnode4 =  new BinTreeNode();
		rnode4.setData("75");
		lnode2.setRChild(rnode4);
		
		BinTreeNode lnode5 =  new BinTreeNode();
		lnode5.setData("xy");
		rnode3.setLChild(lnode5);
		
		BinTreeNode rnode6 =  new BinTreeNode();
		rnode6.setData("Jack");
		rnode3.setRChild(rnode6);
		
		BinTreeNode rnode7 =  new BinTreeNode();
		rnode7.setData("Bob");
		lnode5.setRChild(rnode7);
		
//		Iterator it = binTreeLink.preOrder();
		Iterator it = binTreeLink.preOrder2();
		while(!it.isDone()){
			Node node = (Node) it.currentItem();
			System.out.print(node.getData()+",");
			it.next();
		}
		
	}
}
